package tr.edu.ege.kipler.satisfiability.clash;

import java.util.Set;

import tr.edu.ege.kipler.satisfiability.container.ABox;
import tr.edu.ege.kipler.satisfiability.container.WorldConstraintSystem;
import tr.edu.ege.kipler.syntax.atomicformula.Formula;

/**
 * 
 * @author İnanç Seylan
 *
 */
public class ALCQClashDetectionStrategy implements ClashDetectionStrategy {
	private String explanation;

	private BasicClashDetectionStrategy basicStrategy = new BasicClashDetectionStrategy();

	private AtLeastAtMostClashDetectionStrategy qualifiedRestStrategy = new AtLeastAtMostClashDetectionStrategy();

	private Set<WorldConstraintSystem> dependencySet;

	public boolean hasClash(ABox abox, Formula formula) {
		boolean result = false;
		if (basicStrategy.hasClash(abox, formula)) {
			result = true;
			explanation = basicStrategy.getExplanation();
			dependencySet = basicStrategy.getDependencySet();
		} else if (qualifiedRestStrategy.hasClash(abox, formula)) {
			result = true;
			explanation = qualifiedRestStrategy.getExplanation();
			dependencySet = qualifiedRestStrategy.getDependencySet();
		}
		return result;
	}

	public Set<WorldConstraintSystem> getDependencySet() {
		return dependencySet;
	}

	public String getExplanation() {
		return explanation;
	}

}
